function selectAllMer() {
	var url = '/stock/pages/stock.do?method=selectMer&d=' + new Date();
	$.getJSON(url, {}, callback);
}
function selectMer() {
	var merchandiseCid = document.getElementById('merchandiseCid').value;
	var merchandiseName = document.getElementById('merchandiseName').value;
	var merchandiseType = document.getElementById('merchandiseType').value;
	var merchandiseNorm = document.getElementById('merchandiseNorm').value;
	var url = '/stock/pages/stock.do?method=selectMer&d=' + new Date()
			+ '&merchandiseCid=' + escape(escape(merchandiseCid))
			+ '&merchandiseName=' + escape(escape(merchandiseName))
			+ '&merchandiseTypeId=' + escape(escape(merchandiseType))
			+ '&merchandiseNorm=' + escape(escape(merchandiseNorm));
	$.getJSON(url, {}, callback);
}
function callback(data) {
	var str = "";
	for ( var i = 0; i < data.length; i++) {
		// 动态的改变页面中div节点中的内容
		str = str
				+ '<tr>'
				+ '<td>'+data[i].merchandiseCid+'</td>'
				+ '<td>'+data[i].merchandiseName+'</td>'
				+ '<td>'+data[i].merchandiseTypeName+'</td>'
				+ '<td>'+data[i].merchandiseUnitName+'</td>'
				+ '<td>'+data[i].merchandiseAmount+'</td>'
				+ '<td>'+data[i].merchandiseNorm+'</td>'
				+ '<td>'+data[i].merchandiseMemo+'</td>'
				+ '<td><input style="width: 80px;" id="'+data[i].merchandiseId+'" onclick="this.value=\'\'" value="原数量：'
				+ data[i].merchandiseAlert
				+ '"></td>'
				+ '<td width="40px"><input type="button" value="修改" style=" height: 20px;" onclick="updateMer('
				+ data[i].merchandiseId + ');" /></td>' + '</tr>';
	}
	$("#merList").html(str);
}
function updateMer(iid) {
	var merAlert = document.getElementById(iid).value;
	var url = '/stock/pages/stock.do?method=updateMer&d=' + new Date()
			+ '&merchandiseId=' + iid + '&merchandiseAlert=' + merAlert;
	$.post(url, {}, function(data) {
		alert(data);
	});
}